<?php

namespace App\Http\Controllers\Share;

use App\Common\Result;
use App\Http\Controllers\Controller;
use App\Service\Share\ShareService;
use Illuminate\Http\Request;

class ShareController extends Controller
{
    public function addShare(Request $request)
    {
        Result::isEmpty($request->uid,'无有效用户信息',-16);
        Result::isEmpty($request->articleid,'无有效文章',-17);

        $info = array(
            'uid' => $request->uid,
            'share_source' => $request->source,
            'share_type' => $request->type,
            'article_id' => $request->articleid,
        );

        if(!ShareService::createShareLog($info)){
            Result::msg(-11,'error',"更新失败");
        }
        Result::msg('0','success',$info);
    }
}
        